package exercise;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;

/*
 * ��ҵ3��
�������ɵ��ļ��У������������ε��������ֿ϶���
����-��-23
 */
public class Exercise9 {
	public static void main(String[] args) throws Exception {
        ArrayList<String> list = new ArrayList<>();
        BufferedReader br1 = new BufferedReader(new FileReader("names.txt"));
        String line;
        while ((line = br1.readLine()) != null){
            list.add(line);
        }
        br1.close();
     
        BufferedReader br2 = new BufferedReader(new FileReader("count.txt"));
        String countStr = br2.readLine();
        int count = Integer.parseInt(countStr);
        br2.close();
        count++;
        if(count%2!=0){
            System.out.println("张三");
        }else {
            Collections.shuffle(list);
            String stuInfo = list.get(0);
            System.out.println(stuInfo);
        }

        BufferedWriter bw = new BufferedWriter(new FileWriter("count.txt"));
        bw.write(count + "");
        bw.close();

	}
}
